package router

import (
	"server/application/constant/apis"
	"server/application/controller/sysctrl"
	"server/application/db/system/dbdto"
	"server/pkg/ginp"
)

func init() {
	AppendRouter(ItemInfo{
		Path:           apis.ApiMenuTreeSelectList,                      //api路径
		Handlers:       ginp.ConvHandler(sysctrl.GetMenuSelectTreeList), //对应控制器
		HttpType:       HttpPost,                                        //http请求类型
		NeedLogin:      true,                                            //是否需要登录
		NeedPermission: false,                                           //是否需要鉴权
		PermissionName: "",                                              //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title: "获取树形下拉菜单",
		},
	}) //获取普通的树形菜单【下拉】列表

	AppendRouter(ItemInfo{
		Path:           apis.ApiMenuTreeList,                      //api路径
		Handlers:       ginp.ConvHandler(sysctrl.GetMenuTreeList), //对应控制器
		HttpType:       HttpPost,                                  //http请求类型
		NeedLogin:      true,                                      //是否需要登录
		NeedPermission: false,                                     //是否需要鉴权
		PermissionName: "",                                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title: "获取树形菜单",
		},
	}) //获取普通的树形菜单列表

	AppendRouter(ItemInfo{ //create
		Path:           apis.ApiAuthMenuTreeList,                  //api路径
		Handlers:       ginp.ConvHandler(sysctrl.GetAuthMenuList), //对应控制器
		HttpType:       HttpPost,                                  //http请求类型
		NeedLogin:      true,                                      //是否需要登录
		NeedPermission: false,                                     //是否需要鉴权
		PermissionName: "",                                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title: "获取带权限控制的树形菜单",
		},
	}) //获取【经过鉴权】的树形菜单列表

	AppendRouter(ItemInfo{ //create
		Path:           apis.ApiMenuTreePermission,                      //api路径
		Handlers:       ginp.ConvHandler(sysctrl.GetMenuTreePermission), //对应控制器
		HttpType:       HttpPost,                                        //http请求类型
		NeedLogin:      true,                                            //是否需要登录
		NeedPermission: false,                                           //是否需要鉴权
		PermissionName: "",                                              //完整的权限名称,会跟权限表role_permission匹配
		Swagger: &SwaggerInfo{
			Title: "获取菜单权限树形列表",
		},
	}) //获取【权限】菜单列表,同时在叶子节点加上权限

	AppendRouter(ItemInfo{ //create
		Path:           apis.ApiMenuGetNames,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.GetMenuNames), //对应控制器
		HttpType:       HttpPost,                               //http请求类型
		NeedLogin:      true,                                   //是否需要登录
		NeedPermission: false,                                  //是否需要鉴权
		PermissionName: "",                                     //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title: "获取菜单名称列表",
		},
	}) //获取所有的菜单名称

	AppendRouter(ItemInfo{ //create
		Path:           apis.ApiMenuCreate,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.MenuCreate), //对应控制器
		HttpType:       HttpPost,                             //http请求类型
		NeedLogin:      true,                                 //是否需要登录
		NeedPermission: true,                                 //是否需要鉴权
		PermissionName: "SysMenu.create",                     //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "获取菜单名称列表",
			RequestDto: dbdto.SysMenuCreate{},
		},
	}) //创建菜单

	AppendRouter(ItemInfo{ //create
		Path:           apis.ApiMenuUpdate,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.MenuUpdate), //对应控制器
		HttpType:       HttpPost,                             //http请求类型
		NeedLogin:      true,                                 //是否需要登录
		NeedPermission: true,                                 //是否需要鉴权
		PermissionName: "SysMenu.update",                     //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "修改菜单名称",
			RequestDto: dbdto.SysMenuUpdate{},
		},
	}) //修改菜单

	AppendRouter(ItemInfo{ //create
		Path:           apis.ApiMenuDelete,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.MenuDelete), //对应控制器
		HttpType:       HttpPost,                             //http请求类型
		NeedLogin:      true,                                 //是否需要登录
		NeedPermission: true,                                 //是否需要鉴权
		PermissionName: "SysMenu.delete",                     //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "删除菜单",
			RequestDto: dbdto.SysMenuDelete{},
		},
	}) //删除菜单
	//{{append}}
}
